package FIT::Document::Transformer::AddFooterCell;

use FIT::Class;
use FIT::Document::Parser::Twig;
use FIT::Document::Transformer;

extends 'FIT::Document::Transformer::Base';

has content => (is => 'ro', isa => 'Str', required => 1);

sub _transform {
    my $table      = shift;
    my $body       = $table->get_body;
    my $first_cell = $body->first_cell;
    my $colspan    = $body->first_cell->att('colspan') || 1;
    my $row        = XML::Twig::Elt->new('tr');
    my $cell       = XML::Twig::Elt->new('td');

    $row->paste(last_child => $body);
    $cell->paste(last_child => $row);
    $cell->set_att(colspan => $colspan);
    transform { Note text is $self->content } $cell;

    return $cell;
}

